home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / canyon.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  9KB  |  283 lines

  1. /***************************************************************************
  2.  
  3. Atari Canyon Bomber Driver
  4.  
  5. Memory Map:
  6.         0000-01FF       WRAM
  7.         0400-04FF       W A0=0:MOTOR1, A0=1:MOTOR2
  8.         0500-05FF       W A0=0:EXPLODE, A0=1:TIMER RESET
  9.         0600-067F       W A0=0:WHISTLE1, A0=1:WHISTLE2
  10.         0680-06FF       W A0=0:LED1, A0=1:LED2
  11.         0700-077F       W A0=0:ATTRACT1, A0=1:ATTRACT2
  12.         0800-0FFF       DISPLAY / RAM
  13.         1000-17FF       SWITCHES
  14.         1800-1FFF       OPTIONS
  15.         2000-27FF       ROM1
  16.         2800-2FFF       ROM2
  17.         3000-37FF       ROM3
  18.         3800-3FFF       ROM4 (Program ROM)
  19.        (F800-FFFF)      ROM4 (Program ROM) - only needed for the 6502 vectors
  20.  
  21. If you have any questions about how this driver works, don't hesitate to
  22. ask.  - Mike Balfour (mab22@po.cwru.edu)
  23. ***************************************************************************/
  24.  
  25. #include "driver.h"
  26. #include "vidhrdw/generic.h"
  27.  
  28. /* vidhrdw/canyon.c */
  29. extern void canyon_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  30.  
  31. static READ_HANDLER( canyon_options_r )
  32. {
  33.     switch (offset & 0x03)
  34.     {
  35.         case 0x00:
  36.             return ((input_port_0_r(0) >> 6) & 0x03);
  37.         case 0x01:
  38.             return ((input_port_0_r(0) >> 4) & 0x03);
  39.         case 0x02:
  40.             return ((input_port_0_r(0) >> 2) & 0x03);
  41.         case 0x03:
  42.             return ((input_port_0_r(0) >> 0) & 0x03);
  43.     }
  44.  
  45.     return 0xFF;
  46. }
  47.  
  48. static READ_HANDLER( canyon_switches_r )
  49. {
  50.     switch (offset & 0x07)
  51.     {
  52.         case 0x00:
  53.             return ((input_port_3_r(0) << 7) & 0x80);
  54.         case 0x01:
  55.             return ((input_port_3_r(0) << 6) & 0x80);
  56.         case 0x02:
  57.             return ((input_port_3_r(0) << 5) & 0x80) | input_port_1_r(0);
  58.         case 0x03:
  59.             return ((input_port_3_r(0) << 4) & 0x80) | input_port_2_r(0);
  60.         case 0x04:
  61.             return ((input_port_3_r(0) << 3) & 0x80);
  62.         case 0x05:
  63.             return ((input_port_3_r(0) << 2) & 0x80);
  64.         case 0x06:
  65.             return ((input_port_3_r(0) << 1) & 0x80) | input_port_1_r(0);
  66.         case 0x07:
  67.             return ((input_port_3_r(0) << 0) & 0x80) | input_port_2_r(0);
  68.     }
  69.  
  70.     return 0xFF;
  71. }
  72.  
  73. WRITE_HANDLER( canyon_led_w )
  74. {
  75.     osd_led_w((offset & 0x01), data & 0x01);
  76. }
  77.  
  78. static struct MemoryReadAddress readmem[] =
  79. {
  80.     { 0x0000, 0x01ff, MRA_RAM }, /* WRAM */
  81.     { 0x0800, 0x0bff, MRA_RAM }, /* DISPLAY RAM */
  82.     { 0x1000, 0x17ff, canyon_switches_r }, /* SWITCHES */
  83.     { 0x1800, 0x1fff, canyon_options_r }, /* OPTIONS */
  84.     { 0x2000, 0x27ff, MRA_NOP }, /* PROM1 */
  85.     { 0x2800, 0x2fff, MRA_NOP }, /* PROM2 */
  86.     { 0x3000, 0x37ff, MRA_NOP }, /* PROM3 */
  87.     { 0x3800, 0x3fff, MRA_ROM }, /* PROM4 */
  88.     { 0xfff0, 0xffff, MRA_ROM }, /* PROM4 for 6502 vectors */
  89.     { -1 }    /* end of table */
  90. };
  91.  
  92. static struct MemoryWriteAddress writemem[] =
  93. {
  94.     { 0x0000, 0x01ff, MWA_RAM }, /* WRAM */
  95. //    { 0x0680, 0x06ff, canyon_led_w },
  96.     { 0x0bd0, 0x0bdf, MWA_RAM, &spriteram, &spriteram_size },
  97.     { 0x0800, 0x0bff, videoram_w, &videoram, &videoram_size }, /* DISPLAY */
  98.     { 0x2000, 0x27ff, MWA_NOP }, /* PROM1 */
  99.     { 0x2800, 0x2fff, MWA_NOP }, /* PROM2 */
  100.     { 0x3000, 0x37ff, MWA_NOP }, /* PROM3 */
  101.     { 0x3800, 0x3fff, MWA_ROM }, /* PROM4 */
  102.     { -1 }    /* end of table */
  103. };
  104.  
  105. INPUT_PORTS_START( canyon )
  106.     PORT_START      /* DSW - fake port, gets mapped to Canyon Bomber ports */
  107.     PORT_DIPNAME( 0x03, 0x00, "Language" )
  108.     PORT_DIPSETTING(    0x00, "English" )
  109.     PORT_DIPSETTING(    0x01, "Spanish" )
  110.     PORT_DIPSETTING(    0x02, "French" )
  111.     PORT_DIPSETTING(    0x03, "German" )
  112.     PORT_DIPNAME( 0x30, 0x00, "Misses Per Play" )
  113.     PORT_DIPSETTING(    0x00, "Three" )
  114.     PORT_DIPSETTING(    0x10, "Four" )
  115.     PORT_DIPSETTING(    0x20, "Five" )
  116.     PORT_DIPSETTING(    0x30, "Six" )
  117.     PORT_DIPNAME( 0xC0, 0x80, "Game Cost" )
  118.     PORT_DIPSETTING(    0x80, "1 coin/player" )
  119.     PORT_DIPSETTING(    0xC0, "2 coins/player" )
  120.     PORT_DIPSETTING(    0x40, "2 players/coin" )
  121.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  122.  
  123.     PORT_START      /* IN1 - fake port, gets mapped */
  124.     PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  125.     PORT_BIT(0xFE, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  126.  
  127.     PORT_START      /* IN2 - fake port, gets mapped */
  128.     PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  129.     PORT_BIT(0xFE, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  130.  
  131.     PORT_START      /* IN3 - fake port, gets mapped */
  132.     PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  133.     PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  134.     PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  135.     PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  136.     PORT_SERVICE( 0x10, IP_ACTIVE_HIGH )
  137.     PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK )
  138.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  139.     PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_TILT ) /* SLAM */
  140.  
  141. INPUT_PORTS_END
  142.  
  143.  
  144.  
  145. static struct GfxLayout charlayout =
  146. {
  147.     8,8,    /* 8*8 characters */
  148.     64,     /* 64 characters */
  149.     1,      /* 1 bit per pixel */
  150.     { 0 },  /* no separation in 1 bpp */
  151.     { 4, 5, 6, 7, 12, 13, 14, 15 },
  152.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  153.     16*8    /* every char takes 16 consecutive bytes */
  154. };
  155.  
  156. static struct GfxLayout motionlayout =
  157. {
  158.     32,16,   /* 32*16 characters */
  159.     4,       /* 4 characters? */
  160.     1,       /* 1 bit per pixel */
  161.     { 0 },   /* no separation in 1 bpp */
  162.     { 0x100*8 + 7, 0x100*8 + 6, 0x100*8 + 5, 0x100*8 + 4, 7, 6, 5, 4,
  163.       0x100*8 + 15, 0x100*8 + 14, 0x100*8 + 13, 0x100*8 + 12, 15, 14, 13, 12,
  164.       0x100*8 + 256+7, 0x100*8 + 256+6, 0x100*8 + 256+5, 0x100*8 + 256+4, 256+7, 256+6, 256+5, 256+4,
  165.       0x100*8 + 256+15, 0x100*8 + 256+14, 0x100*8 + 256+13, 0x100*8 + 256+12, 256+15, 256+14, 256+13, 256+12 },
  166.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  167.       8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  168.     64*8     /* every char takes 64 consecutive bytes */
  169. };
  170.  
  171. static struct GfxLayout bomb_layout =
  172. {
  173.     2,2,    /* 2*2 bomb */
  174.     1,      /* 1 character */
  175.     1,      /* 1 bit per pixel */
  176.     { 0 },  /* no separation in 1 bpp */
  177.     { 4, 4 }, /* I know that this bit is 1 */
  178.     { 3*16, 3*16 },  /* I know that this bit is 1 */
  179.     16*8    /* every char takes 16 consecutive bytes */
  180. };
  181.  
  182. static struct GfxDecodeInfo gfxdecodeinfo[] =
  183. {
  184.     { REGION_GFX1, 0, &charlayout,   0, 2 },
  185.     { REGION_GFX2, 0, &motionlayout, 0, 2 },
  186.     { REGION_GFX1, 0, &bomb_layout,  0, 2 },
  187.     { -1 } /* end of array */
  188. };
  189.  
  190.  
  191. static unsigned char palette[] =
  192. {
  193.     0x00,0x00,0x00, /* BLACK */
  194.     0x80,0x80,0x80, /* LT GREY */
  195.     0xff,0xff,0xff, /* WHITE */
  196. };
  197. static unsigned short colortable[] =
  198. {
  199.     0x01, 0x00,
  200.     0x01, 0x02,
  201. };
  202. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  203. {
  204.     memcpy(game_palette,palette,sizeof(palette));
  205.     memcpy(game_colortable,colortable,sizeof(colortable));
  206. }
  207.  
  208.  
  209. static struct MachineDriver machine_driver_canyon =
  210. {
  211.     /* basic machine hardware */
  212.     {
  213.         {
  214.             CPU_M6502,
  215.             750000,        /* 0.3 Mhz ???? */
  216.             readmem,writemem,0,0,
  217.             nmi_interrupt,1
  218.         }
  219.     },
  220.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  221.     1,    /* single CPU, no need for interleaving */
  222.     0,
  223.  
  224.     /* video hardware */
  225.     32*8, 30*8, { 0*8, 32*8-1, 0*8, 30*8-1 },
  226.     gfxdecodeinfo,
  227.     sizeof(palette) / sizeof(palette[0]) / 3, sizeof(colortable) / sizeof(colortable[0]),
  228.     init_palette,
  229.  
  230.     VIDEO_TYPE_RASTER,
  231.     0,
  232.     generic_vh_start,
  233.     generic_vh_stop,
  234.     canyon_vh_screenrefresh,
  235.  
  236.     /* sound hardware */
  237.     0,0,0,0
  238.  
  239. };
  240.  
  241.  
  242. /***************************************************************************
  243.  
  244.   Game ROMs
  245.  
  246. ***************************************************************************/
  247.  
  248. ROM_START( canyon )
  249.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  250.     ROM_LOAD( "9496-01.d1", 0x3800, 0x0800, 0x8be15080 )
  251.     ROM_RELOAD(             0xF800, 0x0800 )
  252.  
  253.     ROM_REGION( 0x400, REGION_GFX1 | REGIONFLAG_DISPOSE )
  254.     ROM_LOAD( "9492-01.n8", 0x0000, 0x0400, 0x7449f754 )
  255.  
  256.     ROM_REGION( 0x200, REGION_GFX2 | REGIONFLAG_DISPOSE )
  257.     ROM_LOAD( "9505-01.n5", 0x0000, 0x0100, 0x60507c07 )
  258.     ROM_LOAD( "9506-01.m5", 0x0100, 0x0100, 0x0d63396a )
  259. ROM_END
  260.  
  261.  
  262. ROM_START( canbprot )
  263.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  264.     ROM_LOAD_NIB_LOW ( "cbp3000l.j1", 0x3000, 0x0800, 0x49cf29a0 )
  265.     ROM_LOAD_NIB_HIGH( "cbp3000m.p1", 0x3000, 0x0800, 0xb4385c23 )
  266.     ROM_LOAD_NIB_LOW ( "cbp3800l.h1", 0x3800, 0x0800, 0xc7ee4431 )
  267.     ROM_RELOAD_NIB_LOW (              0xf800, 0x0800 ) /* for 6502 vectors */
  268.     ROM_LOAD_NIB_HIGH( "cbp3800m.r1", 0x3800, 0x0800, 0x94246a9a )
  269.     ROM_RELOAD_NIB_HIGH (             0xf800, 0x0800 ) /* for 6502 vectors */
  270.  
  271.     ROM_REGION( 0x400, REGION_GFX1 | REGIONFLAG_DISPOSE )
  272.     ROM_LOAD( "9492-01.n8", 0x0000, 0x0400, 0x7449f754 )
  273.  
  274.     ROM_REGION( 0x200, REGION_GFX2 | REGIONFLAG_DISPOSE )
  275.     ROM_LOAD( "9505-01.n5", 0x0000, 0x0100, 0x60507c07 )
  276.     ROM_LOAD( "9506-01.m5", 0x0100, 0x0100, 0x0d63396a )
  277. ROM_END
  278.  
  279.  
  280.  
  281. GAMEX( 1977, canyon,   0,      canyon, canyon, 0, ROT0, "Atari", "Canyon Bomber", GAME_NO_SOUND )
  282. GAMEX( 1977, canbprot, canyon, canyon, canyon, 0, ROT0, "Atari", "Canyon Bomber (prototype)", GAME_NO_SOUND )
  283.